package sapling.logic.algorithm.pcb.queue;

import sapling.logic.object.pcb.ProcessControlBlock;

public abstract class Queue extends Linked<ProcessControlBlock> {

	abstract public boolean enqueue(ProcessControlBlock proc);

	abstract public ProcessControlBlock dequeue();

	abstract public ProcessControlBlock peek();
	
	public ProcessControlBlock[] toArray() {
		ProcessControlBlock[] temp = new ProcessControlBlock[this.length];
		Node<ProcessControlBlock> p = this.getHead().getNext();
		for (int i=0; i<temp.length; i++) {
			temp[i] = p.getData();
			p = p.getNext();
		}
		return temp;
	}

}
